using System.Collections.Generic;
using MoveToDoList;

namespace TestBasecampRestAPI.TestMoveToDoList
{
	class FakeProjectToDoLists : IProjectToDoLists
	{
		public static FakeProjectToDoLists GetInstance()
		{
			return new FakeProjectToDoLists();
		}
		private FakeProjectToDoLists()
		{
		}

		public void AddProject(string name)
		{
			AddProjectCalled = true;
			AddProjectNames.Add(name);
		}
		public bool AddProjectCalled { get; private set; }
		private readonly List<string> AddProjectNames = new List<string>();
		public bool AddProjectCalledFor(string name)
		{
			return AddProjectNames.Contains(name);
		}
		public int AddProjectIndexFor(string name)
		{
			return AddProjectNames.IndexOf(name);
		}

		public int ProjectSelectedIndex
		{
			get
			{
				ProjectSelectedIndexGetCalled = true;
				return ProjectSelectedIndexGetFakeResult;
			}
			set
			{
				ProjectSelectedIndexSetCalled = true;
				ProjectSelectedIndexSetLastValue = value;
			}
		}
		public bool ProjectSelectedIndexGetCalled { get; private set; }
		public int ProjectSelectedIndexGetFakeResult { private get; set; }
		public bool ProjectSelectedIndexSetCalled { get; private set; }
		public int ProjectSelectedIndexSetLastValue { get; private set; }

		public void ClearToDoLists()
		{
			ClearToDoListsCalled = true;
		}
		public bool ClearToDoListsCalled { get; private set; }

		public void ToDoListsAddItem(string item)
		{
			ToDoListsAddItemCalled = true;
			ToDoListsAddItemLastItem = item;
			ToDoListsAddItemLastItems.Add(item);
		}
		public bool ToDoListsAddItemCalled { get; private set; }
		public string ToDoListsAddItemLastItem { get; private set; }
		private readonly List<string> ToDoListsAddItemLastItems = new List<string>();

		public int SelectedList
		{
			get { SelectedListGetCalled = true; return SelectedListGetFakeResult; }
		}

		public int[] SelectedLists
		{
			get { SelectedListsGetCalled = true; return SelectedListsGetFakeResult; }
		}
		public bool SelectedListsGetCalled { get; private set; }
		public int[] SelectedListsGetFakeResult { private get; set; }

		public bool SelectedListGetCalled { get; private set; } 
		public int SelectedListGetFakeResult { private get; set; }

		public bool ToDoListsAddItemCalledForName(string name)
		{
			return ToDoListsAddItemLastItems.Contains(name);
		}
	}
}